import java.sql.Date;
import java.util.GregorianCalendar;
import java.util.Random;

public class RandomDate
{
	GregorianCalendar g = new GregorianCalendar();
	Random rnd = new Random();
	final static int give = 20;

	public Date next()
	{
		int up = rnd.nextInt(2) == 1 ? -1 : 1;
		return next(up);
	}

	public Date next(int dir)
	{
		g.roll(GregorianCalendar.DAY_OF_MONTH, dir * rnd.nextInt(give));
		g.roll(GregorianCalendar.MONTH, dir * rnd.nextInt(give));
		g.roll(GregorianCalendar.YEAR, dir * rnd.nextInt(give));

		return new Date(g.getTimeInMillis());
	}
}
